Design - Interview Questions and Answers for 'Spillman technologies' - 3 question(s) found - Order By Newest Q1. How can we make sure that only one object of a class get's created ? Design
This question was recently asked at 'Spillman Technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Related Questions Difference between == and .equals() ? Why is String immutable in Java ? Explain the scenerios to choose between String , StringBuilder and StringBuffer ?
or
What is the difference between String , StringBuilder and StringBuffer ? What are the difference between composition and inheritance in Java? Explain OOPs
or
Explain OOPs Principles
or
Explain OOPs Concepts
or
Explain OOPs features
or
Tell me something about OOPs What is a Lambda Expression ? What's its use ? Why Char array is preferred over String for storing password? What are different ways to create String Object? Explain. Does garbage collection guarantee that a program will not run out of memory? What is the difference between final, finally and finalize() ? Q2. Given a comma separated string that signifies the current position in 4 * 4 tic tac toes game, write a program that gives the result of the game - If anyone win and if yes then who and if the game is still open.
For example - x,0,x,x,x,0,0,0,0,x,0,x means that 00 index has x, 01 has 0 and so on with x(3,3) has last element x Design
This question was recently asked at 'Spillman Technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Related Questions Difference between == and .equals() ? Why is String immutable in Java ? Explain the scenerios to choose between String , StringBuilder and StringBuffer ?
or
What is the difference between String , StringBuilder and StringBuffer ? What are the difference between composition and inheritance in Java? Explain OOPs
or
Explain OOPs Principles
or
Explain OOPs Concepts
or
Explain OOPs features
or
Tell me something about OOPs What is a Lambda Expression ? What's its use ? Why Char array is preferred over String for storing password? What are different ways to create String Object? Explain. Does garbage collection guarantee that a program will not run out of memory? What is the difference between final, finally and finalize() ? Q3. How can we make sue that only 1 object gets created ? Design
Ans. We can use Singleton Design Pattern. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  singleton Asked in 1 Companies Related Questions Difference between Static and Singleton Class ? What is the difference between Singleton and Prototype Bean scope in Spring ? serialization and deserialization of singleton class What is the difference between these two approaches of creating singleton Class ?
//Double Checked Locking Code
public static Singleton createInstance() {
if(singleton == null){
synchronized(Singleton.class) {
if(singleton == null) {
singleton = new Singleton();
}
}
}
return singleton;
}
//Single checked locking code
public static Singleton createInstance() {
synchronized(Singleton.class) {
if(singleton == null) {
singleton = new Singleton();
}
}
return singleton;
} What are design situations to use Singleton and Prototype Design Pattern ? How to avoid cloning, serialization in the singleton class ? When singleton can break and how to resolve it If you are given choice to either load object eagerly or lazily , which one would you use in case of singleton pattern ? When should we use prototype scope and singleton scope for beans ? Explain Singleton Design Pattern ?